package org.jeecg.modules.basedata.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.entity.basedata.BaseCustomer;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.model.SysDepartTreeModel;
import org.jeecg.vo.basedata.BaseCustomerPage;

import java.util.List;

/**
 * @Description: 业主
 * @Author: jeecg-boot
 * @Date:   2019-07-18
 * @Version: V1.0
 */
public interface BaseCustomerMapper extends BaseMapper<BaseCustomer> {
    public BaseCustomerPage selectByMainId(String mainId);

    List<BaseCustomerPage> listHistory(Page<BaseCustomerPage> page, @Param("baseCustomer") BaseCustomer baseCustomer);

    BaseCustomer queryByRoomId(@Param("roomId") String roomId);

    Integer listCustomerId(String roomid);

    BaseCustomer detailById(@Param("id") String id, @Param("methodId") String methodId);

    /**
     * 自定义多表分页
     * @param page
     * @param baseCustomer
     * @return
     */
     List<BaseCustomerPage> listByParams(@Param("page") Page<BaseCustomerPage> page,@Param("baseCustomer") BaseCustomerPage  baseCustomer);

    Integer getCustomerCount(@Param("roomId") String roomId);


     /*********************************租户*******************************************/
     List<BaseCustomer> getBaseTenantPage(Page<BaseCustomer> page, @Param("ew") Wrapper<BaseCustomer> queryWrapper);
     List<SysDepartTreeModel> queryTenantTreeList(@Param("floorId") String floorId);

     List<SysDepart> querFloorTreList();

     BaseCustomer getTenantByRoomId(@Param("roomId") String roomId);

     String  getByTenantId( @Param("roomId") String roomId);

     String  getByCustomerId( @Param("roomId") String roomId);

    int getCountByRoomIdAndCustomerName(@Param("roomId") String roomId, @Param("customerName") String customerName);

    int getCountByRoomId(@Param("roomId") String roomId);

    List<BaseCustomer> getCustomer(@Param("baseCustomer") BaseCustomer baseCustomer);

}
